package com.qf.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qf.api.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author: sin
 * @Date: 2025/5/21 20:54
 * @Description:
 **/
@TableName(value ="sys_menu")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysMenuEntity extends BaseEntity {
    /**
     *
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 父菜单ID
     */
    @TableField(value = "parent_id")
    private Long parentId;

    /**
     * 路由名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 菜单名称
     */
    @TableField(value = "title")
    private String title;

    /**
     * 路由路径
     */
    @TableField(value = "path")
    private String path;

    /**
     * 组件路径(如果不填,默认就是菜单路径,默认就是菜单路径,从前端src目录开始计算,例如:src/views/ads/index.vue)
     */
    @TableField(value = "component")
    private String component;

    /**
     * 菜单图标
     */
    @TableField(value = "icon")
    private String icon;

    /**
     * 排序
     */
    @TableField(value = "`rank`")
    private Integer rank;

    /**
     * 菜单类型(0:目录 1:菜单 2:接口 3:外链)
     */
    @TableField(value = "type")
    private Integer type;

    /**
     * 按钮权限标识
     */
    @TableField(value = "btn_perm")
    private String btnPerm;

    /**
     * 请求方式
     **/
    @TableField(value = "method")
    private String method;

    /**
     * 是否在菜单中显示
     */
    @TableField(value = "show_link")
    private Boolean showLink;

    /**
     * 是否页面缓存
     **/
    @TableField(value = "keep_alive")
    private Boolean keepAlive;

    /**
     * 内嵌 链接
     **/
    @TableField(value = "frame_src")
    private String frameSrc;

    @TableField(exist = false)
    private List<SysRoleEntity> roles;

    /** 父菜单 **/
    @TableField(exist = false)
    private SysMenuEntity parent;

    public SysMenuEntity(Long id) {
        this.id = id;
    }
}
